package com.own.business.comment.entity.map;

import com.own.business.comment.entity.po.Comment;
import com.own.component.common.base.entity.BaseMap;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * CommentMapVo
 *
 * @author chenxueli
 * @date 2023-07-03 14:15:52
 */
@Schema(title = "评论" + ConstantBeanSuffix.MAP_VO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class CommentMapVo extends BaseMap<Comment> implements Serializable {

    @Schema(title = "评论用户id")
    private Long userId;

    @Schema(title = "评论目标id")
    private Long targetId;

    @Schema(title = "主要内容")
    private String content;

    @Schema(title = "评论上级id")
    private Long commentId;

    @Schema(title = "最初的评论id")
    private Long rootCommentId;

    /**
     * 构造方法
     *
     * @param entity 原对象
     */
    public CommentMapVo(@NonNull Comment entity) {
        super(entity);
        this.userId = entity.getFkUserId();
        this.targetId = entity.getFkTargetId();
        this.content = entity.getContent();
        this.commentId = entity.getFkCommentId();
        this.rootCommentId = entity.getRootCommentId();
    }

}
